package cp3120.model;

/**
 * A Model of a Flight.
 *
 * @author Rowan Spence
 */
public class Flight {

    private int flightID;
    private Airport departureLocation = null;
    private String departureTime = null;
    private Airport arrivalLocation = null;
    private String arrivalTime = null;
    private int seats = 0;
    private float price;

    /**
     * Class Constructor, Setting all the data members
     * @param flightID          The ID of the flight
     * @param departureLocation Where the flight leaves from
     * @param departureTime     When the flight leaves
     * @param arrivalLocation   Where the flight goes to
     * @param arrivalTime       When the flight arrives
     * @param price             Customers price of the flight.
     */
    public Flight(int flightID, Airport departureLocation, String departureTime, Airport arrivalLocation,
                  String arrivalTime, int seats, float price) {
        this.flightID = flightID;
        this.departureLocation = departureLocation;
        this.departureTime = departureTime;
        this.arrivalLocation = arrivalLocation;
        this.arrivalTime = arrivalTime;
        this.seats = seats;
        this.price = price;
    }

    public Flight() {

    }

    public Ticket getTicket() {
        Ticket ticket = new Ticket();
        ticket.setFlight(this);
        return ticket;
    }

    /**
     * Simple Getter
     * @return  The flights ID.
     */
    public int getFlightID() {
        return flightID;
    }

    /**
     * Simple Getter
     * @return The flights Departure location.
     */
    public Airport getDepartureLocation() {
        return departureLocation;
    }

    /**
     * Simple Getter
     * @return  The flights Departure time.
     */
    public String getDepartureTime() {
        return departureTime;
    }

    /**
     * Simple Getter
     * @return  The flights arrival location.
     */
    public Airport getArrivalLocation() {
        return arrivalLocation;
    }

    /**
     * Simple Getter
     * @return  The flights Arrival time.
     */
    public String getArrivalTime() {
        return arrivalTime;
    }

    /**
     * Simple Getter
     * @return The Number of available seats on the flight
     */
    public int getSeats() {
        return seats;
    }

    /**
     * Simple Getter
     * @return The Price per seat to the customer, including GST
     */
    public float getPrice() {
        return price;
    }

    public void setArrivalLocation(Airport arrivalLocation) {
        this.arrivalLocation = arrivalLocation;
    }

    public void setArrivalTime(String arrivalTime) {
        this.arrivalTime = arrivalTime;
    }

    public void setDepartureLocation(Airport departureLocation) {
        this.departureLocation = departureLocation;
    }

    public void setDepartureTime(String departureTime) {
        this.departureTime = departureTime;
    }

    public void setFlightID(int flightID) {
        this.flightID = flightID;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public void setSeats(int seats) {
        this.seats = seats;
    }

    public String toString() {
        return getDepartureLocation().toString() + " to " + getArrivalLocation().toString();
    }
}
